'use strict';

describe('fbdApp ruleService module', function() {

  var $rootScope, modalService;

  beforeEach(module('fbdApp.modalModule'));

  beforeEach(inject(function(_$rootScope_, _modalService_) {
    $rootScope = _$rootScope_;
    modalService = _modalService_;

    var fakeModal = {
      result: {
        then: function(callback) {
          callback('testing');
        }
      }
    };

    spyOn(modalService, 'showModal').and.returnValue(fakeModal);
    $rootScope.$apply();
  }));


  it('should be defined', function(done) {
    expect(modalService).not.toBe(null);
    expect(modalService.showModal).toBeDefined();
    return done();
  });


  it('no', function(done) {
    var modalInstance = modalService.showModal();
    // console.log(modalInstance);
    modalInstance.result.then(function(res) {
      expect(res).toBe('testing');
      return done();
    });
    // return done();
  });


});
